﻿package mortal.game.net.command.medal
{
    import Framework.MQ.*;
    import Message.DB.Tables.*;
    import Message.Public.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.mvc.core.*;

    public class MedalUpdateCommand extends BroadCastCall
    {

        public function MedalUpdateCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_3:SAttributeUpdate = null;
            var _loc_4:TMedal = null;
            var _loc_2:* = param1.messageBase as SSeqAttributeUpdate;
            for each (_loc_3 in _loc_2.updates)
            {
                
                switch(_loc_3.attribute.__value)
                {
                    case EEntityAttribute._EAttributeMedal:
                    {
                        _loc_4 = MedalConfig.instance.getTmedalByCode(_loc_3.value);
                        Cache.instance.medal.addMedal(_loc_4);
                        if (_loc_2.code == UpdateCode.EUpdateCodeMedalAdd)
                        {
                            NetDispatcher.dispatchCmd(ServerCommand.MedalAdd, _loc_4);
                        }
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            return;
        }// end function

    }
}
